<?php
include ("conn.php");
include ("util.php");
include ("pubf.php");

$user = get_header("username");
$stat = get_header("status");
$pawd = md5(get_header("password"));

$row = has_username ($user);
if (! $row) 
    die (err_msg ("没有该帐号"));

$sql = "select * from user where name='$user' and pawd='$pawd' limit 1";
$row = has_one($sql);
if (! $row)
    die (err_msg('密码错误'));
else {
    @session_start();
    $_SESSION['id'] = $row['uid'];
    $_SESSION['username'] = $row['name'];
    echo (suc_msg("登录成功!"));
}
    

?>
